package com.zzyl.test;

import cn.hutool.http.HttpResponse;
import cn.hutool.http.HttpUtil;
import cn.hutool.http.Method;
import com.zzyl.common.utils.http.HttpUtils;
import org.junit.Test;

import java.util.HashMap;
import java.util.Map;

public class testHttp {
    @Test
     public void testCreateRequest() {
        //用hutool测试get请求
        // 构建查询参数
        Map<String,Object> paramMap = new HashMap<>();
        paramMap.put("pageNum", 1);
        paramMap.put("pageSize", 5);
        HttpResponse response = HttpUtil.createRequest( Method.GET,"http://localhost:9000/nursing/project/list")
                .header("Authorization", "Bearer eyJhbGciOiJIUzUxMiJ9.eyJsb2dpbl91c2VyX2tleSI6IjNmYWZiNjA5LTliMzYtNDVjYi1hMTU3LTNiMjg4NGE0YTNhZCJ9.op0ItVZI2-zsnIOt0Sg5ccH-3xpX5aOn_cGVLlzCtwtnHU9Igk-XtLJsBYzMMjWpwm7-ExXFIbcTlqZCilERpg")
                .form(paramMap)
                .execute();
        if(response.isOk()){
            System.out.println(response.body());
        }
    }
}
